<template>
  <view class="content">
    <view class="title" style="font-size:50rpx; font-weight: bold;">子组件B</view>
    <view class="b-box">
      CompA组件传进来的值：
      <text class="intent-text-box" style="font-weight: bold; color: blue;">{{result}}</text>
    </view>
    <view class="b-box" style="margin: 10rpx;">
      <text>回传值：</text>
      <input type="text" v-model="callbackValue" style="color: yellow; border: 1rpx solid #ddd; padding: 10rpx;" />
      <button @click="sendOutside()" size="mini">回传</button>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      result: '',
      callbackValue: '0595-2788888'
    }
  },
  mounted() {
    uni.$on('getIntent', (data) => {
      this.result = data;
    });
  },
  methods: {
    sendOutside() {
      this.$emit('callBackFun', this.callbackValue);
    }
  }
}
</script>

<style>
/* 子组件B样式：调整文本间距、输入框样式 */
.b-box {
  margin: 10rpx 0;
}
</style>